﻿package Interface.ShopClasses
{	
	import Core.Game;

	public class VisualizationShopItem extends ShopItem 
	{
		protected var FDescription:String;	
		
		public function VisualizationShopItem():void 
		{
			FDescription = 'No description';
			super();
		}
		
		override public function get Description():String
		{
			var vPrice:String = FPrice.toString();
			
			if(FPrice == 0)
				vPrice += '(товар уже приобретен)';
				
			return FDescription + '. Цена: ' + vPrice;
		}
		
		override public function set Description(ADescription:String):void
		{
			FDescription = ADescription;
		}
		
		override public function Buy(AGame:Game):void
		{			
			AGame.User.Money -= Price;
			AGame.User.Visualization = ProfileGraphic;
			AGame.User.AddToUserItems(GlobalID);
			AGame.Gameplay.Visualization = AGame.User.Visualization;
			AGame.UpdateProfile();
			Price = 0;
		}
	}	
}
